<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>新瑞途-员工注册</title>
    <meta name="Generator" content="vsCode">
    <meta name="Author" content="x">
    <meta name="Keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge chrome=1">
    <!--IE8浏览器的显示方式：IE=edge以IE最高版本显示 Chrome=1以谷歌浏览器模式渲染-->
    <meta name="referrer" content="never">
    <!--告诉浏览器链接的来源（可以计算链接的访问量）-->
    <meta name="format-detection" content="telephone=no,email=no,address=no">
    <!--格式检测（数字，邮箱，地址）no 不识别为电话号码，邮箱，地址-->
    <meta name="renderer" content="webkit">
    <meta name="Description" content="">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet" />

    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        ul,li{
            list-style:none;
        }
        a{
            text-decoration:none;
        }
        input{
            outline-style:none;
            border: 0px;
        }
        #form1{

            margin-top:20px;
            width:80%;
            margin:2px auto;
        }
        #form1 form span{
            color:#999;
        }
        .row {
            margin-top: 25px;
            height: 50px;
            line-height: 26px;
            border-bottom: 1px solid #c7c6c6;
            width:100%;
        }
        .input {
            position: relative;
            width: 100%;
            height: 26px;
        }
        .input input {
            display: block;
            width: 100%;
            height: 26px;
            border:none;
            background: none;
            outline:none;
        }
        .input label {
            position: absolute;
            top:0;
            left:0;
            height: 26px;
            line-height: 26px;
            font-size: 14px;
            color: #999;
        }
        .select select{
            display:block;
            width:100%;
            border:none;
            outline:none;
        }
        input[type=date]::-webkit-inner-spin-button { visibility: hidden; }
        .button{
            width:100%;
            height:40px;
            background: #50a688;
            outline: none;
            margin:20px 0 30px 0;
        }
        .button button{
            border:0px;
            background-color:transparent;
            color:white;
            width: 100%;
            height:40px;
            margin:0 auto;
            font-size:17px;
        }

    </style>
</head>

<body>
<div id="form1">
    <form action="" method="post">
        <br>
        <div>
            <h2 class="modal-title text-center" id="accLogModelHead">员工注册</h2>
        </div>
        <div class="row ">
            <div class="input">
                <span style="font-size: 130%;font-weight: bold;">姓名</span><br>
                <input style="font-size: 120%" type="text" id="realName" name="realName" placeholder="请输入真实姓名"/><br>
            </div>
        </div>
        <div class="row">
            <div class="input">
                <span style="font-size: 130%;font-weight: bold;">手机</span><br>
                <input style="font-size: 120%" id="phone" type="text" name="phone" placeholder="请输入手机号码"/><br>
                <i class="Phone"><b></b></i>
            </div>
        </div>
        <div class="button">
            <button style="font-size: 140%" type="button" onclick="redister();">注 &nbsp;&nbsp;&nbsp;&nbsp; 册</button>
        </div>
    </form>
</div>
<script src="/static/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/static/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/static/bower_components/datatables.net/js/jquery.dataTables.min.js"></script>
<script src="/static/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
    function checkForm(realName,phone){

        if(!/^[\u4e00-\u9fa5]{2,30}$/.test(realName)){
            alert("请输入正确的姓名");
            return false;
        }
        if(!/^1[34578][0-9]\d{8}$/.test(phone)){
            alert("请输入正确的手机号");
            return false;
        }
        return true;
    }

    function redister() {
        var realName = $("#realName").val();
        var phone = $("#phone").val();
        if(checkForm(realName,phone)){

            $.ajax({
                url:"/wx/register",
                type:"post",
                dataType:"json",
                cache:false,
                data:{
                    realName:realName,
                    phone:phone
                },
                success:function(data){
                    if(data.status == 'success'){
                        var username = data.data.username;
                        location.href = "/wx/registerToLogin?username="+username;
                    }else{
                        alert(data.msg);
                    }
                }
            });
        }
    }
</script>
</body>
</html>
